package edu.mse.camel.client.playback.editors;

import org.eclipse.gef.GraphicalViewer;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;

import edu.mse.camel.client.posterboard.ui.editor.PosterBoardEditor;
import edu.mse.camel.client.posterboard.ui.editor.dnd.PBUMLDiagramDropTargetListener;
import edu.mse.camel.client.posterboard.ui.editor.dnd.PBWBDiagramDropTargetListener;
import edu.mse.camel.client.posterboard.ui.handlers.GenericReceiveEventHandler;

public class PosterboardPlaybackEditor extends PosterBoardEditor {

	public static final String ID = "edu.mse.camel.client.playback.editor";
	
	private boolean isSource = false;
	
	@Override
	public void init(IEditorSite site, IEditorInput input)
			throws PartInitException {
		if (initializeSession()) {
			isSource = false;
		}
		/*
		this.getEditDomain().setCommandStack(
				new CamelCommandStack(pbModelManager, isSource));
		*/
		super.init(site, input);
		
		// If initialization of the session fails the editor will exit
		
		/*
		if (!isSource) {
			updateHandler = 
				new ModelUpdateEventHandler(pbModelManager);
			EventManager.getInstance().
				subscribeTo(EventIDs.MODEL_UPDATE_EVENT2, updateHandler);
			dListener = new DiagramListener(pbModelManager);
			pbModelManager.getPapyrusModelManager().
					getDiResource().eAdapters().add(dListener);
						
		}
		genericHandler = new GenericReceiveEventHandler();
		*/
		
		
	}
	
	/*
	@Override
	protected void initializeGraphicalViewer() {
		GraphicalViewer viewer = getGraphicalViewer();
		viewer.getControl().addDisposeListener(new org.eclipse.swt.events.DisposeListener() {
			public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
			}
		});
		
		viewer.getControl().setBackground(diagramColor);
		
		// DND setup
		viewer.addDropTargetListener(new PBUMLDiagramDropTargetListener(viewer));
		viewer.addDropTargetListener(new PBWBDiagramDropTargetListener(viewer));
		
		// set the contents of this editor
		// This starts the creation of editparts
		viewer.setContents(getModel()); 
		
	}
	*/
}
